package com.mypackage.diary.modle;

// Generated Oct 28, 2014 3:47:35 PM by Hibernate Tools 4.0.0

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * UserProfile generated by hbm2java
 */
@Entity
@Table(name = "UserProfile")
public class UserProfile implements java.io.Serializable {

	private int userId;
	private Membership membership;
	private Serializable userName;
	private Serializable email;
	private Set<Diary> diaries = new HashSet<Diary>(0);
	private Set<UserProfile> userProfilesForFriendId = new HashSet<UserProfile>(
			0);
	private Set<Category> categories = new HashSet<Category>(0);
	private Set<DiaryPermission> diaryPermissions = new HashSet<DiaryPermission>(
			0);
	private Set<FriendRequest> friendRequestsForReceiverId = new HashSet<FriendRequest>(
			0);
	private Set<FriendRequest> friendRequestsForSenderId = new HashSet<FriendRequest>(
			0);
	private Set<Role> roles = new HashSet<Role>(0);
	private Set<UserProfile> userProfilesForUserId = new HashSet<UserProfile>(0);
	private Set<Comment> comments = new HashSet<Comment>(0);

	public UserProfile() {
	}

	public UserProfile(Membership membership) {
		this.membership = membership;
	}

	public UserProfile(Membership membership, Serializable userName,
			Serializable email, Set<Diary> diaries,
			Set<UserProfile> userProfilesForFriendId, Set<Category> categories,
			Set<DiaryPermission> diaryPermissions,
			Set<FriendRequest> friendRequestsForReceiverId,
			Set<FriendRequest> friendRequestsForSenderId, Set<Role> roles,
			Set<UserProfile> userProfilesForUserId, Set<Comment> comments) {
		this.membership = membership;
		this.userName = userName;
		this.email = email;
		this.diaries = diaries;
		this.userProfilesForFriendId = userProfilesForFriendId;
		this.categories = categories;
		this.diaryPermissions = diaryPermissions;
		this.friendRequestsForReceiverId = friendRequestsForReceiverId;
		this.friendRequestsForSenderId = friendRequestsForSenderId;
		this.roles = roles;
		this.userProfilesForUserId = userProfilesForUserId;
		this.comments = comments;
	}

	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "membership"))
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "UserId", unique = true, nullable = false)
	public int getUserId() {
		return this.userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public Membership getMembership() {
		return this.membership;
	}

	public void setMembership(Membership membership) {
		this.membership = membership;
	}

	@Column(name = "UserName")
	public Serializable getUserName() {
		return this.userName;
	}

	public void setUserName(Serializable userName) {
		this.userName = userName;
	}

	@Column(name = "Email")
	public Serializable getEmail() {
		return this.email;
	}

	public void setEmail(Serializable email) {
		this.email = email;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userProfile")
	public Set<Diary> getDiaries() {
		return this.diaries;
	}

	public void setDiaries(Set<Diary> diaries) {
		this.diaries = diaries;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "userProfilesForUserId")
	public Set<UserProfile> getUserProfilesForFriendId() {
		return this.userProfilesForFriendId;
	}

	public void setUserProfilesForFriendId(
			Set<UserProfile> userProfilesForFriendId) {
		this.userProfilesForFriendId = userProfilesForFriendId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userProfile")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userProfile")
	public Set<DiaryPermission> getDiaryPermissions() {
		return this.diaryPermissions;
	}

	public void setDiaryPermissions(Set<DiaryPermission> diaryPermissions) {
		this.diaryPermissions = diaryPermissions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userProfileByReceiverId")
	public Set<FriendRequest> getFriendRequestsForReceiverId() {
		return this.friendRequestsForReceiverId;
	}

	public void setFriendRequestsForReceiverId(
			Set<FriendRequest> friendRequestsForReceiverId) {
		this.friendRequestsForReceiverId = friendRequestsForReceiverId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userProfileBySenderId")
	public Set<FriendRequest> getFriendRequestsForSenderId() {
		return this.friendRequestsForSenderId;
	}

	public void setFriendRequestsForSenderId(
			Set<FriendRequest> friendRequestsForSenderId) {
		this.friendRequestsForSenderId = friendRequestsForSenderId;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "UsersInRoles", joinColumns = { @JoinColumn(name = "UserId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "RoleId", nullable = false, updatable = false) })
	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "userProfilesForFriendId")
	public Set<UserProfile> getUserProfilesForUserId() {
		return this.userProfilesForUserId;
	}

	public void setUserProfilesForUserId(Set<UserProfile> userProfilesForUserId) {
		this.userProfilesForUserId = userProfilesForUserId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userProfile")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

}
